#include "krautchanagent.h"
#include "components/chan.h"
#include "krautchantasksendpost.h"

namespace Wishmaster
{
	KrautchanAgent::KrautchanAgent(const QString& host) : DefaultAgent(host), m_host(host)
	{
	}

	KrautchanAgent::~KrautchanAgent()
	{
	}

	void KrautchanAgent::makePost(const PostDescriptor& post, const QString& captcha)
	{
		TaskPtr task = TaskPtr(new KrautchanTaskSendPost(post, captcha, requestManager(), QString("Sending post"), this));
		connect(task.data(), SIGNAL(result(KrautchanTaskSendPost*, QByteArray,QString)), this, SLOT(resultPost(KarehaTaskSendPost*, QByteArray,QString)));

		taskhub()->queueTask(task);
	}

	void KrautchanAgent::createThread(const PostDescriptor& post, const QString& captcha)
	{
		TaskPtr task = TaskPtr(new KrautchanTaskSendPost(post, captcha, requestManager(), QString("Sending post"), this));
		connect(task.data(), SIGNAL(result(KrautchanTaskSendPost*, QByteArray,QString)), this, SLOT(resultPost(KarehaTaskSendPost*, QByteArray,QString)));

		taskhub()->queueTask(task);
	}

	void KrautchanAgent::deleteThread(const ThreadId& threadId, const QString& password)
	{
	}

	void KrautchanAgent::deletePost(const PostId& postId, const QString& password)
	{
	}

	QStringList KrautchanAgent::ratings()
	{
		return QStringList();
	}

	ChanAgent* KrautchanAgent::clone(const QString& host)
	{
		return new KrautchanAgent(host);
	}

	QString KrautchanAgent::id()
	{
		return "krautchan";
	}
}

Q_EXPORT_PLUGIN2(krautchanagent, Wishmaster::KrautchanAgent)

